home *** CD-ROM | disk | FTP | other *** search
-
- Here are the current templates for the "new" program.
-
- ==============================================================================
-
- Template 1. Function test driver (created using -md)
-
- #ifndef lint
- static char * $n_$e_rcsid =
- "$Header: $n.$e,v $r $y/$c/$d $h:$m:$s $w Exp $";
-
- static char * $n_$e_source =
- "$Source$";
-
- #endif
-
- /*
- * NAME:
- * $n
- *
- * SYNOPSIS:
- * $n [other option flags] args
- *
- * DESCRIPTION:
- * "$n" is a test driver for the function "func".
- * $u
- * OPTIONS:
- * Describe any options on the command line.
- *
- * AUTHOR:
- * $x
- *
- * BUGS:
- * None noticed.
- *
- * REVISIONS:
- *
- * $Log$
- */
-
- #include <stdio.h>
- #include <strings.h>
-
- main (argc, argv)
- int argc;
- char ** argv;
- {
-
- /*
- * Variables.
- */
-
- char * program;
- char * slash;
- $v
- /*
- * Store the program name and remove it from the argument list.
- */
-
- if (slash = rindex (*argv, '/'))
- program = slash + 1;
- else
- program = *argv;
-
- argv++;
- argc--;
-
- /*
- * Prepare for the call.
- */
-
- printf ("Before call to new\n");
-
- /*
- * Call the function.
- */
-
- new ();
- printf ("After call to new\n");
- exit (0);
- }
-
- ==============================================================================
-
- Template 2. Generic function (created using -mf)
-
- #ifndef lint
- static char * $n_$e_rcsid =
- "$Header: $n.$e,v $r $y/$c/$d $h:$m:$s $w Exp $";
-
- static char * $n_$e_source =
- "$Source$";
-
- #endif
-
- /*
- * NAME:
- * $n
- *
- * SYNOPSIS:
- * $t $n ($l)
- *
- * DESCRIPTION:
- * $u
- *
- * ARGUMENTS:
- * Describe any function arguments.
- *
- * AUTHOR:
- * $x
- *
- * BUGS:
- * None noticed.
- *
- * REVISIONS:
- *
- * $Log$
- */
-
- $i
- $p
- $g
-
- $t $n ($l)
- $a{
-
- /*
- * Functions.
- */
-
- $f
- /*
- * Variables.
- */
-
- $v
- /*
- * Processing.
- */
-
- $b
- return (0);
- }
-
- ==============================================================================
-
- Template 3. Header file (created using -mh)
-
- #ifndef lint
- static char * $n_$e_rcsid =
- "$Header: $n.$e,v $r $y/$c/$d $h:$m:$s $w Exp $";
-
- static char * $n_$e_source =
- "$Source$";
-
- #endif
-
- /*
- * NAME:
- * $n.$e
- *
- * SYNOPSIS:
- * #include "$n.$e"
- *
- * DESCRIPTION:
- * Header file for "$n".
- * $u
- * AUTHOR:
- * $x
- *
- * BUGS:
- * None noticed.
- *
- * REVISIONS:
- *
- * $Log$
- */
-
- #include <stdio.h>
-
- ==============================================================================
-
- Template 4. Main routine using simple I/O
- (created using -mi)
-
- #ifndef lint
- static char * $n_$e_rcsid =
- "$Header: $n.$e,v $r $y/$c/$d $h:$m:$s $w Exp $";
-
- static char * $n_$e_source =
- "$Source$";
-
- #endif
-
- /*
- * NAME:
- * $n
- *
- * SYNOPSIS:
- * $n [other option flags] string
- *
- * DESCRIPTION:
- * "$n" does the following:
- * $u
- * OPTIONS:
- * Describe any options on the command line.
- *
- * AUTHOR:
- * $x
- *
- * BUGS:
- * None noticed.
- *
- * REVISIONS:
- *
- * $Log$
- */
-
- #include <stdio.h>
- #include <strings.h>
-
- main (argc, argv)
- int argc;
- char ** argv;
- {
-
- /*
- * Functions.
- */
-
-
- /*
- * Variables.
- */
-
- FILE * instream;
-
- char * path;
- char * program;
- char * slash;
-
- /*
- * Store the program name and remove it from the argument list.
- */
-
- if (slash = rindex (*argv, '/'))
- program = slash + 1;
- else
- program = *argv;
-
- argv++;
- argc--;
-
- /*
- * Either open an input file, or read "stdin".
- */
-
- if (argc > 0)
- {
- path = *argv;
- instream = fopen (path, "r");
-
- if (instream == (FILE *) NULL)
- {
- fprintf (stderr, "%s: can't open\n", path);
- exit (1);
- }
- }
- else
- instream = stdin;
-
- /*
- * Processing.
- */
-
- $b
- /*
- * Close the input file, if it's not stdin.
- */
-
- if (instream != stdin)
- fclose (instream);
-
- exit (0);
- }
-
- ==============================================================================
-
- Template 5. Generic main routine (created using -mm)
-
- #ifndef lint
- static char * $n_$e_rcsid =
- "$Header: $n.$e,v $r $y/$c/$d $h:$m:$s $w Exp $";
-
- static char * $n_$e_source =
- "$Source$";
-
- #endif
-
- /*
- * NAME:
- * $n
- *
- * SYNOPSIS:
- * $n [other option flags] string
- *
- * DESCRIPTION:
- * "$n" does the following:
- * $u
- * OPTIONS:
- * Describe any options on the command line.
- *
- * AUTHOR:
- * $x
- *
- * BUGS:
- * None noticed.
- *
- * REVISIONS:
- *
- * $Log$
- */
-
- $i
- #include <strings.h>
- $p
- $g
-
- main (argc, argv)
- int argc;
- char ** argv;
- {
-
- /*
- * Functions.
- */
-
- $f
- /*
- * Variables.
- */
-
- char * ofile;
- char * program;
- char * slash;
-
- extern char * optarg;
- extern int optind;
-
- int c;
- int errflg;
- $v
- /*
- * Store the program name.
- */
-
- if (slash = rindex (*argv, '/'))
- program = slash + 1;
- else
- program = *argv;
-
- /*
- * Process the argument list.
- */
-
- errflg = 0;
-
- while ((c = getopt (argc, argv, "abo:")) != -1)
- {
- switch (c)
- {
- case 'a':
- printf ("Read option 'a'\n");
- break;
-
- case 'b':
- printf ("Read option 'b'\n");
- break;
-
- case 'o':
- ofile = optarg;
- printf ("Read option 'o', arg is (%s)\n",
- ofile);
- break;
-
- case '?':
- errflg++;
- }
- }
-
- if (errflg)
- {
- (void) fprintf (stderr, "usage: %s ... file\n", program);
- exit (2);
- }
-
- for (; optind < argc; optind++)
- {
- printf ("File (%s)\n", argv[optind]);
- }
-
- /*
- * Main processing.
- */
-
- $b
- exit (0);
- }
-
- ==============================================================================
-
- Template 6. Generic "stub" function (created using -ms)
-
- #ifndef lint
- static char * $n_$e_rcsid =
- "$Header: $n.$e,v $r $y/$c/$d $h:$m:$s $w Exp $";
-
- static char * $n_$e_source =
- "$Source$";
-
- #endif
-
- /*
- * NAME:
- * $n
- *
- * SYNOPSIS:
- * $t $n ($l)
- *
- * DESCRIPTION:
- * $u
- *
- * ARGUMENTS:
- * Describe any function arguments.
- *
- * AUTHOR:
- * $x
- *
- * BUGS:
- * None noticed.
- *
- * REVISIONS:
- *
- * $Log$
- */
-
- #include <stdio.h>
- #include <ctype.h>
-
- int $n ()
- {
-
- printf ("Entering function \"$n\"\n");
- return (0);
- }
-